package com.vivo.ic.dm;

import com.vivo.ic.dm.tools.TestUtils;
import com.example.vdmtest.tools.DownloadConfig;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by bruce on 2017/2/23.
 */
public class DownloadManagerTest extends BaseTest{

    @Before
    public void setUp() throws Exception {
        // 删除数据库多余数据
        mResolver.delete(Downloads.Impl.CONTENT_URI, null, null);
    }

    @After
    public void tearDown() throws Exception {
        // 删除数据库多余数据
        mResolver.delete(Downloads.Impl.CONTENT_URI, null, null);
    }

    @Test
    public void init() throws Exception {
        Config oldConf = mManager.getConfig();

        // 测试空值初始化
        mManager.init(null);

        // 测试自定义初始
        DownloadConfig downloadConfig = new DownloadConfig.Builder()
                .setDownloadNotiDealer(new DownloadNotiDealerEmpty())
                .setDownloadNotifier(new DownloadNotifierEmpty())
                .setNetChangeDealer(null).build();
        mManager.init(downloadConfig);

        mManager.init(oldConf);
    }

    @Test
    public void isAllDownloadComplete() throws Exception {
        mManager.startDownload(TestUtils.getOkUrlDownloadValues());
        mManager.startDownload(TestUtils.get404DownloadValues());
        Thread.sleep(200);
        assertTrue(!mManager.isAllDownloadComplete());
        Thread.sleep(2000);
        assertTrue(mManager.isAllDownloadComplete());
    }

    @Test
    public void addDownloadListener() throws Exception {

    }

    @Test
    public void removeDownloadListener() throws Exception {

    }

    @Test
    public void clear() throws Exception {

    }

    @Test
    public void getDownloadQuene() throws Exception {

    }

    @Test
    public void pauseDownloadInqueue() throws Exception {

    }

    @Test
    public void pauseDownload() throws Exception {

    }

    @Test
    public void continueDownloadInquene() throws Exception {

    }

    @Test
    public void continueDownload() throws Exception {

    }

    @Test
    public void startDownloadInquene() throws Exception {

    }

    @Test
    public void startDownload() throws Exception {

    }

    @Test
    public void cancelDownloadInquene() throws Exception {

    }

    @Test
    public void cancelDownload() throws Exception {

    }

    @Test
    public void getNetChangeDealer() throws Exception {

    }

    @Test
    public void getNotifier() throws Exception {

    }

    @Test
    public void getNotiDealer() throws Exception {

    }

    @Test
    public void getConfig() throws Exception {

    }

    @Test
    public void setLastNetType() throws Exception {

    }

    @Test
    public void getLastNetType() throws Exception {

    }

    @Test
    public void notifyDownloadSpeed() throws Exception {

    }

    @Test
    public void notifyDownloadSize() throws Exception {

    }

    @Test
    public void notifyDownloadStoped() throws Exception {

    }

    @Test
    public void notifyDownloadPausedByNetChange() throws Exception {

    }

    @Test
    public void notifyDownloadStartByNetChange() throws Exception {

    }

}